<template>
  <div class="home-page">
    <h1>欢迎来到主页</h1>
    <div class="button-container">
      <button @click="goTo('/studentTask')">成绩列表</button>
      <button @click="goTo('/tasks')">任务列表</button>
      <button @click="goTo('/todoList')">待办列表</button>
      <button @click="goTo('https://gitee.com/rran99/001')">仓库地址</button>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router';

const router = useRouter();

const goTo = (path) => {
  if (path.startsWith('http')) {
    window.open(path, '_blank');
  } else {
    router.push(path);
  }
};
</script>

<style scoped>
.home-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: #f0f2f5;
  font-family: 'Arial', sans-serif;
}

h1 {
  color: #333;
  margin-bottom: 40px;
  font-size: 2.5em;
}

.button-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

button {
  background-color: #409eff;
  color: white;
  border: none;
  padding: 15px 30px;
  font-size: 1.2em;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  min-width: 180px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button:hover {
  background-color: #66b1ff;
  transform: translateY(-2px);
}

button:active {
  background-color: #3a8ee6;
  transform: translateY(0);
}

/* 响应式调整 */
@media (max-width: 768px) {
  .button-container {
    flex-direction: column;
    align-items: center;
  }

  button {
    width: 80%;
    max-width: 300px;
  }
}
</style>